package com.yaowk.sfp.system.api;

import com.yaowk.sfp.common.base.model.result.NavMenu;
import com.yaowk.sfp.common.base.model.result.Transfer;
import com.yaowk.sfp.common.base.model.result.Tree;
import com.yaowk.sfp.system.api.model.Menu;
import com.yaowk.sfp.system.api.model.Resource;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient("system")
@RequestMapping("/system/menu")
public interface MenuApi {

    @GetMapping
    Tree<Menu, Long> list();

    @GetMapping("/{id}")
    Menu findOne(@PathVariable Long id);

    @PostMapping
    Menu save(Menu menu);

    @DeleteMapping("/{id}")
    void delete(@PathVariable Long id);

    @GetMapping("/{menuId}/resource")
    Transfer<Resource, Long> menuResource(@PathVariable Long menuId);

    @PostMapping("/{menuId}/resource")
    void editMenuResource(@PathVariable Long menuId, @RequestParam(required = false) List<Long> resourceId);


}
